import Vue from 'vue'
import VueRouter from 'vue-router'

/*  主页，登录，注册对应的 Vue 组件*/
import Content from '../components/Content'
// import Header from '../components/Header'
import Welcome from '../components/Welcome'
import Login from '../components/Login'
import Register from '../components/Register'

/*  下面是各种 API 对应的 Vue 组件*/
import Jokes from '../components/apis/amusement/Jokes'
import Timestamp from '../components/apis/Timestamp'
import Weather from '../components/apis/amusement/Weather'
import HistoryToday from '../components/apis/amusement/HistoryToday'
import RandomImage from '../components/apis/amusement/RandomImage'
import QRCode from '../components/apis/amusement/QRCode'
import DomesticNews from '../components/apis/news/DomesticNews'
import InternationalNews from '../components/apis/news/InternationalNews'
import SportNews from '../components/apis/news/SportNews'
import BlockChainNews from '../components/apis/news/BlockChainNews'
import ClothesNews from '../components/apis/news/ClothesNews'
import BeautifulSentence from '../components/apis/amusement/BeautifulSentence'
import RandomHeadPortrait from '../components/apis/amusement/RandomHeadPortrait'
import LoveSentence from '../components/apis/amusement/LoveSentence'
import NickName from '../components/apis/amusement/NickName'
import TangPoem from '../components/apis/amusement/poem/TangPoem'
import BeautifulPoem from '../components/apis/amusement/poem/BeautifulPoem'
import WeatherPoem from '../components/apis/amusement/poem/WeatherPoem'
import LovePoem from '../components/apis/amusement/poem/LovePoem'
import HeadPoem from '../components/apis/amusement/poem/HeadPoem'
import WYWMusic from '../components/apis/music/WYWMusic'
import RGBColor from '../components/apis/program/RGBColor'
import MD5 from '../components/apis/program/MD5'
import ImageToWord from '../components/apis/ai/ImageToWord'
import BingImage from '../components/apis/program/BingImage'
// import Component from '../components/MyComponent'
import MyComponent from '../components/MyComponent'
import Guess from '../components/guess/Guess'

// “票据生成功能暂停服务”
import TicketImage from '../components/apis/ai/TicketImage'

// Vue 对象使用路由
Vue.use(VueRouter)

/*
    注意：
      当前这个路由实例对象是挂载在 App.vue 上面的
* */
/*  定义一个路由规则常量，创建路由实例对象时将会用到  */
const routes = [
  /*  主页  */
  {
    path: '/',
    /*  使用命名路由，在一个页面中同级展示多个Vue组件*/
    component: Content,
    redirect: "/welcome",
    children: [
      { path: "/welcome", component: Welcome},
      { path: "/jokes", component: Jokes},
      { path: "/timestamp", component: Timestamp},
      { path: "/weather", component: Weather},
      { path: '/historytoday', component: HistoryToday},
      { path: "/randomimage", component: RandomImage},
      { path: "/qrcode", component: QRCode},
      { path: "/domesticnews", component: DomesticNews},
      { path: "/internationalnews", component: InternationalNews},
      { path: "/sportnews", component: SportNews},
      /*  区块链新闻做了防盗链*/
      { path: "/blockchainnews", component: BlockChainNews},
      { path: "/clothesnews", component: ClothesNews},
      { path: "/beautifulsentence", component: BeautifulSentence},
      { path: "/randomheadportrait", component: RandomHeadPortrait},
      { path: "/lovesentence", component: LoveSentence},
      { path: "/nickname", component: NickName},
      { path: "/tangpoem", component: TangPoem},
      { path: "/beautifulpoem", component: BeautifulPoem},
      { path: "/weatherpoem", component: WeatherPoem},
      { path: "/lovepoem", component: LovePoem},
      { path: "/headpoem", component: HeadPoem},
      { path: "/wywMusic", component: WYWMusic},
      { path: "/rgbcolor", component: RGBColor},
      { path: "/md5", component: MD5},
      { path: "/imagetoword", component: ImageToWord},
      { path: "/bingimage", component: BingImage},
      { path: "/component", component: MyComponent},
      { path: "/guess", component: Guess},
      // “票据生成服务暂停”
      { path: "/ticketimage", component: TicketImage}

    ]
  },
  /*  登录  */
  { path: '/login', name: "Login", component: Login},
  /*  注册  */
  { path: "/register", name: "Register", component: Register}
]

/*  创建路由实例对象,利用全局的 VueRouter 构造函数  */
const router = new VueRouter({
  /*  项目上线之前，要把这个 mode 的值改成 hash  */
  mode: 'hash',
  routes
})

/*  将这个路由实例对象暴露出去 */
export default router
